Skip to content

fix(studio): a permission set's review link opens the draft review on its matrix page - #37347

Merged
objectstack-fleet[bot] merged 3 commits into
mainfrom
claude/issue-37269-permission-set-review
Nov 25, 2026
Merged

objectstack-fleet[bot] merged 3 commits into
mainfrom
claude/issue-37269-permission-set-review

Conversation

@objectstack-fleet

@objectstack-fleet objectstack-fleet Bot commented Nov 25, 2026 •

Copy link
Copy Markdown
Contributor

Fixes #37269

Clause-②: no
Metadata-protocol: none

维护者速读

  • 用户能看到的变化:在软件包页点某个权限集草稿的链接,或在聊天里点「审阅 N 处改动」,打开权限集矩阵页时会弹出审阅面板,列出这份草稿相对已发布版本改了什么;Studio 的权限集页也一样,矩阵照常可以编辑。
  • 为什么做:属于「Studio 重构」专题;以前这两个入口打开的矩阵页上看不到任何改动,审阅链接等于失效。
  • 出错会怎样:最坏情况是审阅链接打开后面板不弹出或内容不对:权限集之外,其他类型的审阅也改走同一段共享代码(已有测试钉住,行为不变);矩阵编辑不受影响。纯界面改动,直接撤回即可。
  • 要你做什么:无。

What changes

A review link (?review=1) on a permission-set draft now opens the draft review on the set's matrix page, the same review sheet the generic item page opens.

  • Shared presentation, not a second one. The generic item page's review sheet (ResourceEditPage's Sheet around DraftReviewPanel) moves into DraftReviewSheet, and its ?review=1 arrival effect into useDraftReviewArrival (read afresh, open once the read settles and a draft is pending, then drop ?review=1 with a history replace). ResourceEditPage now uses both; its behaviour is unchanged and its existing pins (ResourceEditPage.detailTabs-36901) pass on the shared hook.
  • The matrix honours ?review=1. PermissionMatrixEditPage uses the same hook and sheet. That covers Studio's StudioPermissionSetPage (which embeds the matrix, package leg) and the routed matrix on the cross-package leg, where both producers' links land (/studio/~all/metadata/permission/NAME?review=1, through Setup's metadata redirect).
    • At the arrival the matrix reads the pending draft and the published set on their own, at the matrix's layered address (layeredPackageId: the page's package, else the route's ?package=), else by name alone, as the generic page reads a draft. The matrix's own load is not asked again, so an unsaved matrix edit is kept, and the matrix stays editable under the sheet and after it closes.
    • No pending draft: no review opens, and ?review=1 still leaves the address. No published set readable: no review (nothing to compare against).
    • Without ?review=1 the matrix reads exactly what it read before.
  • Address. ?review=1 is dropped the way the generic page drops it; AreaItemOpen decides its page once per item (StudioMetadataArea.tsx), so dropping the query does not move the set off its matrix page. No routing changed.
  • Not changed: the two producers (PackagesPage.tsx, AppContent.tsx), the flow and object review links, StudioMetadataArea.tsx, server, spec and routes. No locale key added.

Changeset: .changeset/37269-permission-set-review-link.md (@object-ui/app-shell patch).

Read first (by risk)

  1. ui/packages/app-shell/src/views/metadata-admin/PermissionMatrixEditor.tsx, the new block above const [draft, setDraft]: the arrival's own draft and published read, and the sheet added to dialogsEl.
  2. ui/packages/app-shell/src/views/metadata-admin/useDraftReviewArrival.ts: the arrival effect moved out of ResourceEditPage; callbacks are read through a ref refreshed in an effect that runs before the arrival effect.
  3. ui/packages/app-shell/src/views/metadata-admin/ResourceEditPage.tsx: the inline effect and sheet replaced by the shared hook and component.

Two-minute verification

On a showcase dev server, open Setup, then Packages, then a package with a pending permission-set draft, and click that draft's link. Expected: Studio opens the set's matrix with a right-hand sheet titled "Draft review" listing the changed keys, and the address no longer carries review=1.

Tests

New pins, all at head of this branch:

  • StudioPermissionSetPage.fullScreen-36905.test.tsx, new top-level describe (the real Studio page and matrix):
    • ?review=1 shows the draft's change against the published set (only label differs), read at the page's package, then leaves the address;
    • editing stays: Escape closes the review onto the matrix, whose bulk buttons are enabled;
    • CONTROL: without ?review=1, a set with a pending draft opens no review, and the matrix's load is the only draft read.
  • permissionReviewLinks-37269.test.tsx (new; the real PackageDetailSheet, the real StudioMetadataArea on the cross-package leg, the real matrix registered as the type's EditPage):
    • the Packages page's per-draft link (href asserted, then clicked) reaches the matrix with the review shown, the matrix cells enabled, the draft read by name;
    • the chat's 「Review N change(s)」 (setupMetadataStudioPath(item, 'review=1'), as DraftReviewNavigator calls it) reaches the same;
    • CONTROL: the same page without ?review=1 opens no review and reads no draft;
    • a set with no pending draft opens no review, and ?review=1 still leaves the address.
  • Unchanged and green: the flow and object review links (StudioMetadataArea.routes-28561), the generic page's review (ResourceEditPage.detailTabs-36901), the redirect tables (setupMetadataRedirect, AppContent.setupMetadataStudio-28578).
Runs (head f781168)
  • @object-ui/app-shell type-check (both programs, tsc --noEmit and tsconfig.test.json): os-verify-lock VERDICT command-exit 0 (at the feature commit; the later refactor commit only moved the hook to its own module, and eslint on the moved files is clean).
  • The new pins plus every suite that reads ?review=1 or the review panel (11 files): Test Files 11 passed (11), Tests 281 passed (281), VERDICT command-exit 0.
  • Every ResourceEditPage.*, PermissionMatrixEditor.* and StudioPermissionSetPage.* suite (113 files): Test Files 113 passed (113), Tests 664 passed (664), VERDICT command-exit 0.
  • eslint on the changed files: 0 errors; no warning on a changed line.
Ablations (one per pin, each through scripts/ablation-replace.mjs, restored to the HEAD blob with git diff HEAD empty)
Mutation Result
matrix arrival off (enabled: true to false in PermissionMatrixEditor.tsx) 5 red: both Studio review pins, both producer pins, the no-draft address pin; both CONTROLs green
arrival ignores the param (useDraftReviewArrival.ts) 3 red: both CONTROLs (Studio, cross-package leg), plus one detailTabs case
generic page arrival off (ResourceEditPage.tsx) 2 red: detailTabs ?review=1 opens the review and is consumed, and its CONTROL
?review=1 kept in the address (useDraftReviewArrival.ts) 6 red: the generic page's two, the Studio address pin, both producer pins, the no-draft address pin
area never asks the generic page (StudioMetadataArea.tsx) 2 red: the object CONTROL and the flow review case in routes-28561

Each leg ran the four suites (StudioPermissionSetPage.fullScreen-36905, permissionReviewLinks-37269, ResourceEditPage.detailTabs-36901, StudioMetadataArea.routes-28561; 76 tests) under the lock; each mutation landed (anchor 1 to 0) and was restored to its HEAD blob.

Acceptance notes

  • The matrix offers no chip to reopen the review once it is closed (the generic page has its header chip). The card asks for the arrival only; a reopen affordance on the matrix header would be a separate UX change.
  • On the cross-package leg the matrix shows the published set (it has no package to read a draft at), while the review sheet shows the pending draft read by name. That is the matrix's existing behaviour on that leg; the sheet is what says what the draft changes.
  • The arrival reads afresh at every ?review=1, as the generic page does; unlike the generic page it does not reload the editor, so a same-item arrival keeps unsaved matrix edits.

Verification

Local, on f781168f (exit code read before any pipe):

  • pnpm check:test-source-alias: exit 0.
  • pnpm --dir ui check:i18n-keys: exit 0.
  • node scripts/pm/overlap-check.mjs: exit 0 (VERDICT clean; no open PR shares a file). With --pr=37341,37338: exit 0, both merge cleanly. The claude/issue-37236-* and claude/issue-37237-* branches share no file with this diff.
  • node scripts/pm/dispatch-gates.mjs --commands derived 39 commands. At the time of writing 28 had run locally: 27 exit 0 (the changeset gates, check:nul-bytes, check:cross-package-test-inputs, check:adr-anchors, check:published-files, check:sdui-manifest among them), and check:query-options-erasure hit the local 300 s wrapper timeout (exit 124): NOT MEASURED locally, left to CI. The rest, and pnpm --dir ui exec vitest run scripts/ (this diff touches no script), are left to CI.

CI: in progress at the time of writing.


Generated by Claude Code

…on its matrix page

The generic item page's review sheet and its ?review=1 arrival move into
DraftReviewSheet / useDraftReviewArrival; PermissionMatrixEditPage (Studio's
permission-set page and the routed one) uses both.

Claude-Session: https://claude.ai/code/session_01QSeKYnq7io51czLb81MZMd
Co-authored-by: Claude <noreply@anthropic.com>
…e, the routed matrix and both producers

Claude-Session: https://claude.ai/code/session_01QSeKYnq7io51czLb81MZMd
Co-authored-by: Claude <noreply@anthropic.com>
…ts callbacks refresh in an effect

Claude-Session: https://claude.ai/code/session_01QSeKYnq7io51czLb81MZMd
Co-authored-by: Claude <noreply@anthropic.com>
@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#4 · os-justin · session_01QSeKYpEsWWE9Y5YtSsDgqZ

席位核对 — REWORK · L1 · head f781168fef26fb59f84146acc04c93b9d7c0fd17 · 2026-11-25T22:16Z

PR #37347 → #37269 (zone a4-S). Final report 7174275022, zone finalize 7175456635. I checked everything against GitHub and my own runs, not against the report.

Checklist

  • Shape (l1-face.mjs --pr 37347: CLEAN, 13 items, none flagged). The PR is an open draft against main. The first line is Fixes #37269, and no closing keyword binds any other card. Merging delivers the whole card, so Fixes is right. There is no releases path and no NUL suspect.

  • Card fit, on every path the card names.

    • The Packages page per-draft link (PackagesPage.tsx:1335, APP/metadata/TYPE/NAME?review=1) is pinned. The test renders the real PackageDetailSheet, asserts the href, clicks the link, and follows Setup's redirect onto the real StudioMetadataArea ~all leg. The real matrix is registered as the type's EditPage.
    • The chat's 「Review N change(s)」 path is pinned through setupMetadataStudioPath(item, 'review=1'). That is the same call DraftReviewNavigator makes at AppContent.tsx:286, which I checked at head.
    • Studio's StudioPermissionSetPage on the package leg is pinned in StudioPermissionSetPage.fullScreen-36905.
    • Setup's routed PermissionMatrixEditPage is the ~all leg. ResourceEditPage's dispatcher hands the type's EditPage the route whenever !createMode, so the matrix and MetadataResourceEditPageImpl are never mounted together. No page runs two ?review=1 arrivals.
    • The CONTROLs (no ?review=1, so no review and no extra draft read), the no-draft case, and the flow and object links (StudioMetadataArea.routes-28561, unchanged and green) are all present. Done-when, "both producers' links on a permission-set draft show what the draft changes", is met.
  • The extraction preserves ResourceEditPage's behaviour (my own read of the diff):

    • The hook's effect deps are [reviewParam, enabled, loading, hasDraft], where enabled = !createMode. That is the old [reviewParam, createMode, loading, hasDraft].
    • reload and open are the same two setters.
    • The callbacks and query reach the effect through a ref. The refresh effect is declared before the arrival effect in the same hook, so it runs first in the same commit and the arrival effect sees that render's values, as the old closure did.
    • The ref, the bump, the wait-for-settle and the replace drop of review follow the same sequence.
    • DraftReviewSheet renders the old Sheet markup unchanged (same classes, same two keys, DraftReviewPanel), with the same published={layered?.effective ?? null} and draft={draft}.
    • setSearchParams left ResourceEditPage together with its only use. Both type-check programs are green in CI.
    • Existing suites at head, run by me: every ResourceEditPage.* suite plus every suite that reads ?review=1 or the review panel. That is 74 files: Test Files 74 passed (74), Tests 600 passed (600).
  • Matrix arrival.

    • reload sets reviewReading and bumps the nonce in one batch, so the hook never reads a stale hasDraft with loading false.
    • A refused draft read gives answer: null, so no review opens.
    • MetadataClient.layered answers a 404 as an all-null envelope (PermissionMatrixEditor.tsx, the objectui#7611 comment), so a never-published set is reviewed against null, as on the generic page.
    • Only another read failure (for example, a name two packages hold, read without a package) yields no review.
    • The matrix already used useSearchParams, so the hook adds no Router dependency. The matrix is never mounted in create mode (CreatePage is separate), so enabled: true is right.
  • Translation keys. released-keys-removed.mjs --tag @object-ui/i18n@18.6.0 ran read-only against head and against base a182fbe3. Both report total 77, and the removed-key groups are identical. The PR removes no released key. No catalogue file is in the diff, and the sheet uses two existing keys (designer.draftReview.title, designer.canvas.reviewVsPublished). No new keys, so nothing to complete.

  • Declarations and changeset.

    • readClause2Line on the card's only and newest Claim: comment (7172764928), the PR body and the changeset all return {kind: declared, value: no, arm: null}.
    • readMetadataProtocolLine returns none on all three, so the claim matches the body.
    • Clause-②: no is correct. @object-ui/app-shell is private: true, its only export is ., and no index.ts re-exports DraftReviewSheet, useDraftReviewArrival or DRAFT_REVIEW_*. No props change.
    • none gives patch, which is what .changeset/37269-permission-set-review-link.md says for @object-ui/app-shell. A root .changeset/ file for app-shell follows the repo convention (257 such files on main).
    • I checked the changeset sentence by sentence against the diff, and all nine sentences hold, including "No locale keys, props or entry exports change".
  • Pins at head (my run, throwaway worktree, deps built with CI's ui-deps turbo closure). The 4 pinned suites plus the two redirect suites (setupMetadataRedirect, AppContent.setupMetadataStudio-28578): Test Files 6 passed (6), Tests 201 passed (201).

  • Ablations (scripts/ablation-replace.mjs, each anchor 1→0, each restored to the HEAD blob with git diff HEAD empty, over the 4 pinned suites, 76 tests):

    Mutation Result
    A1: matrix arrival enabled: true changed to false 5 red: both Studio review pins, both producer pins, the no-draft address pin. Both CONTROLs green.
    A3: generic page enabled: !createMode changed to false 2 red: detailTabs ?review=1 opens the review and is consumed, and its CONTROL
    A4: the hook's next.delete(DRAFT_REVIEW_PARAM) removed 6 red: detailTabs ×2, Studio address pin, both producer pins, the no-draft pin
    A5 (mine, not in the report): matrix hasDraft forced to false 4 red: both producer pins, Studio review pin, Studio editing pin. The no-draft pin and both CONTROLs stay green.

    The dev's A1, A3 and A4 counts reproduce exactly.

  • Check-runs at head. 51 runs: 38 success, 13 skipped (all expected-skip per l1-face), 0 failed, 0 pending, and no legacy commit status. Lint & Repo Gates, TypeScript Type Check, Lint UI, Type Check UI, Test UI, Check Changeset and Governed Surface Queue Guard are all success.

  • Merge state.

  • K = 7 (origin/main 134b71db). It was 6 at the zone's finalize 2026-11-25T21:42Z; test(runtime): get_record_context answers one caller with the same bytes on the /mcp and stdio doors over a real kernel #37350 has landed since, and it is a runtime test. Under 15, so no merge of main is owed before queueing.

  • Contract review: not owed. Clause-②: no without a (narrowing) arm, no packages/spec/src/**, and no governed path among the 7 files. Not Tier H: under 3,000 lines and not governed. CI plus this seat read is the whole review.

  • Report evidence. Every gate reading in the report names f781168f. The two local timeouts (check:query-options-erasure, check:type-check-debt) are NOT MEASURED locally, and their CI jobs are success at head. The report's mcp_calls are all reads.

Findings

  • S1 (should-fix) — The 维护者速读 understates the risk in 「出错会怎样」. It says 「矩阵编辑和其他类型的审阅不受影响」. After this PR, every other type's ?review=1 arrival runs through the shared useDraftReviewArrival, and every other type's review sheet renders through DraftReviewSheet. A defect there would break the review link for every type, not only the permission set's. That outcome is what the extraction preserves (pinned by A3/A4), not a worst case it rules out. In the same bullet set, 「在软件包页点某个权限集草稿的「审阅」」 names a label the page does not show: the per-draft link reads TYPE · NAME (PackagesPage.tsx:1340). Body-only fix by the zone before landing, no head move. Suggested 「出错会怎样」: 「最坏情况是审阅链接打开后面板不弹出或内容不对:权限集之外,其他类型的审阅也改走同一段共享代码(已有测试钉住,行为不变);矩阵编辑不受影响。纯界面改动,直接撤回即可。」 and 「点某个权限集草稿的链接」 for the first bullet.
  • N1 — The "What changes" bullet says the arrival reads the draft "at the address its load reads". That holds for the published (layered) read only. The matrix's load reads a draft at the door's packageId alone (PermissionMatrixEditor.tsx:1159), while the arrival reads it at layeredPackageId, else by name. The Acceptance notes already state the cross-package consequence. Wording only; nothing owed.
  • N2 — On the cross-package leg, where both producers land, the matrix under the sheet shows the published set while the sheet shows the draft. The matrix behaved this way before this PR, and the Acceptance notes record it. It is the more meaningful gap behind the parity question (below), not a defect of this PR.
  • N3 — The chat pin re-states DraftReviewNavigator's navigate call rather than mounting AppContent. The call is the same shape as AppContent.tsx:286, and the redirect is pinned separately in AppContent.setupMetadataStudio-28578. Accepted.
  • N4 — reviewRead is not keyed on name. If one matrix instance were reused across sets, a stale read would remain, but it is closed. A new arrival sets loading before it reads hasDraft, so no stale review opens. Harmless.

Parity ux card (zone Q1 A)

I agree with A: no reopen chip in this PR, and no parity card filed now.

  • The card's Done-when is the arrival, and it is met.
  • There is no measured pull for a chip on the matrix header (startup no-diffusion axis).
  • On Studio's package leg, the surface's Changes panel and pending count already reach the package's drafts.
  • The producers' links stay where they were, so the review can be opened again.

If a card is filed later, scope it to the cross-package leg (N2): the matrix there shows the published set under a draft review, and that, not a missing chip, is what a user would trip on. That calls for a design ruling, so a needs-user-decision card, not a ux chip card.

Landing

  • The zone lands it after the S1 body edit (no head move; the seat then posts a same-head delta ACCEPT). K = 7 < 15: no merge of main first. Changeset present. Not Tier H, and no contract review owed.

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#4 · os-justin · session_01QSeKYpEsWWE9Y5YtSsDgqZ

席位核对 — ACCEPT · L1 · head f781168fef26fb59f84146acc04c93b9d7c0fd17 · 2026-11-25T22:43Z

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#4 · os-justin · session_01QSeKYkkwuF6UuFtu85Yd5H

Landing · 2026-11-25T22:45Z · head f781168f · zone a4-S (#37269)

  • L1: seat repo:objectstack#4 REWORK 7176164153 (S1, body only), then a same-head delta ACCEPT 7176714096 at f781168f. No must-fix. No contract review is owed.
    • The S1 body edit was made by the dev through the relay (addendum 7176228609) and the head did not move.
    • Seat nits N1–N4 are recorded and do not block.
    • N2 (on the cross-package leg the matrix shows the published set under a draft review) is a possible future needs-user-decision; nothing is filed now.
  • check-governed-merges.mjs --pr 37347: NOT governed; 556 changed lines, under 3,000.
  • Checks on the head, newest run of each: 36 success, 15 expected skips, 0 failed.
  • K: GitHub compare puts the head 10 commits behind main, under 15. merge-tree with origin/main is clean.
  • Clause-②: no, Metadata-protocol: none. Final report 7174275022; finalized-head note on 权限集的「审阅草稿」链接打开矩阵页,但那里没有审阅面板:软件包页和聊天里的「审阅 N 处改动」点进去看不到改了什么 #37269.
  • Action: ready, then auto-merge through the merge queue.

@objectstack-fleet
objectstack-fleet Bot marked this pull request as ready for review November 25, 2026 22:45
@objectstack-fleet
objectstack-fleet Bot added this pull request to the merge queue Nov 25, 2026
Merged via the queue into main with commit d5ae7a4 Nov 25, 2026
56 checks passed
@objectstack-fleet
objectstack-fleet Bot deleted the claude/issue-37269-permission-set-review branch November 25, 2026 23:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation size/l tooling Fix lands in tooling, not a product package — enters pm:queue only with Unblocks: or a named surface

Projects

None yet

2 participants